﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LinuxTools
{
    class Util
    {
        public static List<HostInfo> getHostInfoList(string hosts)
        {
            List<HostInfo> HostInfoList = new List<HostInfo>();
            string Hosts = hosts;
            string[] HostList = Hosts.Split(Environment.NewLine);
            for (int i = 0; i < HostList.Length; i++)
            {
                var hostItem = HostList[i].Split(" ");
                if (hostItem.Length < 2)
                {
                    continue;
                }
                HostInfo hi = new HostInfo();
                hi.IP = hostItem[0];
                hi.User = hostItem[1];
                hi.Password = hostItem[2];
                HostInfoList.Add(hi);
            }
            return HostInfoList;
        }
        public static string ReadHostFile()
        {
            var hosts = Utils.FileTools.ReadFile("host.txt");
            return hosts;
        }
    }
}
